//
//  PersonCenterCell.m
//  sensen_ios
//
//  Created by mc on 16/2/23.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "PersonCenterCell.h"

@implementation PersonCenterCell

+(instancetype)cellWithTableView:(UITableView*)tableView{
    
    static NSString * cellIdentifier = @"PersonCenterCell";
    PersonCenterCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell ==nil) {
        cell = [[self alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
}

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.contentView.backgroundColor = [UIColor clearColor];
        [self setupSubViews];
    }
    return self;
}


- (void)setupSubViews{
    self.headImgView = [[UIImageView alloc] init];
    [self addSubview:self.headImgView];
    [self.headImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(10);
        make.centerY.equalTo(self.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(30, 30));
    }];
    
    self.titleLabel = [[UILabel alloc] init];
    [self addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headImgView.mas_right).offset(10);
        make.centerY.equalTo(self.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(100, 30));
    }];
    self.titleLabel.textAlignment = NSTextAlignmentLeft;
    self.titleLabel.font = [UIFont systemFontOfSize:15];
    
    
    self.introduceLabel = [[UILabel alloc] init];
    [self addSubview:self.introduceLabel];
    [self.introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-45);
        make.centerY.equalTo(self.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(100, 30));
    }];
    self.introduceLabel.textAlignment = NSTextAlignmentRight;
    self.introduceLabel.font = [UIFont systemFontOfSize:12];
    self.introduceLabel.textColor = [UIColor darkGrayColor];
    
    
    self.accessoryImgView = [[UIImageView alloc] init];
    [self addSubview:self.accessoryImgView];
    [self.accessoryImgView mas_makeConstraints:^(MASConstraintMaker *make){
        make.right.equalTo(self).offset(-10);
        make.centerY.equalTo(self.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(15, 15));
    }];
    self.accessoryImgView.image = [UIImage imageNamed:@"更多设置_查看详情"];
    self.accessoryImgView.hidden = YES;
}
@end
